package com.qianbao.qianbaobusiness.ui.help;

import com.androidbase.base.mvp.RxMvpPresenter;
import com.androidbase.utils.RxUtils;
import com.baseandroid.config.MyApi;
import com.baseandroid.retrofit.RxObserver;
import com.baseandroid.retrofit.json.Data;
import com.qianbao.qianbaobusiness.json.HelpBean;

import javax.inject.Inject;

public class HelpPresenter extends RxMvpPresenter<HelpView> {
    MyApi mApi;

    @Inject
    public HelpPresenter(MyApi api) {
        mApi = api;
    }

    /**
     * 拉取所有帮助列表
     */
    public void getHelpCenterListList() {
        mApi.getHelpCenterListList()
                .compose(RxUtils.applySchedulersLifeCycle(getView()))
                .subscribe(new RxObserver<Data<HelpBean>>(){
                    @Override
                    public void onNext(Data<HelpBean> helpBeanData) {
                        if(RxObserver.checkJsonCode(helpBeanData,false)){
                            getView().onSuccess(helpBeanData.getResult());
                        }
                    }
                });
    }
}
